package com.company.project.web.finance.controller;


import com.company.project.common.enums.RestCodeEnum;
import com.company.project.common.utils.RestUtil;
import com.company.project.common.pojo.Rest;
import com.company.project.web.finance.pojo.bill.BillForm;
import com.company.project.web.finance.service.BillService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 任建波
 * @since 2019-09-09
 */
@Controller
@RequestMapping("/finance/bill")
public class BillController {

    @Autowired
    private BillService billService;

    @ApiOperation(value = "下单")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "header", name = "xxxToken", value = "请求头token", required = true, dataType = "String"),
    })
    @RequestMapping(value = "placeOrder", method = RequestMethod.GET)
    @ResponseBody
    public Rest placeOrder(@RequestBody BillForm billForm) {
        billService.placeOrder(billForm);

        return RestUtil.rest(RestCodeEnum.CODE_200.getCode(), RestCodeEnum.CODE_200.getDesc());
    }

}

